<template>
  <view class="public-transfer">
    <view class="pay-for-panel">
      <view class="pay-for-panel__icon">
        <image class="icon" :src="payForPanelIconUrl" />
      </view>
      <view class="pay-for-panel__tips">
        请你联系公司财务在 {{ deadLineTime }} 前完成以下汇款，否则将支付失败
      </view>

      <view class="cell">
        <view class="main">
          <view class="label"> 支付金额 </view>
          <view class="value"> ¥ {{ price }}元 </view>
        </view>
        <view class="desc"> 请汇入指定金额，非指定金额将支付失败。 </view>
      </view>

      <view class="cell">
        <view class="main">
          <view class="label"> 收款账号 </view>
          <view class="value account"> 270320500000076 </view>
        </view>
        <view class="desc">
          每个注册账号对成的25位收款账号不同，请勿重复打款
        </view>
      </view>

      <view class="cell">
        <view class="main">
          <view class="label"> 收款公司名 </view>
          <view class="value"> 贵阳高新产业投资（集团）有限公司 </view>
        </view>
      </view>

      <view class="cell">
        <view class="main">
          <view class="label"> 开户银行 </view>
          <view class="value"> 贵阳农商银行龙王支行 </view>
        </view>
      </view>

      <view class="cell">
        <view class="main">
          <view class="label"> 备注信息 </view>
          <view class="value"> {{ payName }} 支付 </view>
        </view>
      </view>
    </view>
    <view class="other-info-panel">
      <text class="desc"> 请使用与主体一致的对公账号汇款。 </text>
      <view class="cell">
        <view class="main">
          <view class="label"> 汇款账户名称 </view>
          <view class="value"> 贵阳高新智慧运营管理有限公司 </view>
        </view>
      </view>
      <view class="tips">
        <text class="desc">
          温馨提示：若取消预定，请联系我们线下办理退款。
        </text>
        <text class="desc"> 联系电话：0851-84766886/18985546686 </text>
      </view>
    </view>
    <view class="fixed-btn">
      <up-button
        class="btn__update-certificate"
        shape="circle"
        text="上传凭证"
        color="linear-gradient(to right, #FF934C, #FC686F)"
        @tap="handleUpdateCertificateBtnClick"
      />
    </view>
  </view>
</template>
<script setup>
import { inject, ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import {
  getFormattedDateAfterDays,
  getUrlParamsInH5,
  getUrlParamsInWeixin,
} from "@/utils/utils";
import { userLeaseOrderPublicTransferApi } from "@/package_property/pages/api/life-services.js";
import { customNav } from "@/utils/customNav";

const imgUrlPrefix = inject("baseImgUrl");
const payForPanelIconUrl = `${imgUrlPrefix}2024-04-26/1714111929431shijian@2x.png`;
const orderId = ref("");
const price = ref(0);
const payName = ref("");
const orderData = ref({});
const handleUpdateCertificateBtnClick = async () => {
  customNav(
    `update-certificate?orderId=${orderId.value}&payName=${
      payName.value
    }&orderData=${JSON.stringify(orderData.value)}`
  );
  // const res = await userLeaseOrderPublicTransferApi(orderData.value);
  // const { code, data } = res || {};
  // if (code == 200) {
  //   uni.showToast({
  //     title: "支付成功",
  //     duration: 2000,
  //     success: () => {
  //       customNav(`list`);
  //     },
  //   });
  // }
};

const deadLineTime = ref("");
onShow(() => {
  deadLineTime.value = getFormattedDateAfterDays(3, "ymd");
});

onLoad(() => {
  /* #ifdef MP-WEIXIN */
  const option = JSON.parse(getUrlParamsInWeixin()?.information);

  orderData.value = option;
  orderId.value = option?.orderId;
  price.value = option?.allAmount;
  payName.value = "房屋租金";
  // console.log(orderData.value)
  /* #endif */

  /* #ifndef MP-WEIXIN */
  const option = JSON.parse(getUrlParamsInH5()?.information);
  orderData.value = option;
  orderId.value = option?.orderId;
  price.value = option?.price;
  payName.value = "房屋租金";
  /* #endif */
});
</script>
<style scoped lang=less>
@import "./style/public-transfer";
</style>
